\html_inputfield

Class to create an HTML input field

Summary

Methods
Properties
Constants
__construct()
show()
tag()
doctype()
div()
p()
img()
a()
span()
label()
iframe()
script()
br()
attrib_string()
parse_attrib_string()
quote()
$doctype
$lc_tags
$common_attrib
$containers
$bool_attrib
No constants found
No protected methods found
$tagname
$content
$attrib
$allowed
$type
N/A
No private methods found
No private properties found
N/A

Properties

$doctype

$doctype

$lc_tags

$lc_tags

$common_attrib

$common_attrib

$containers

$containers

$bool_attrib

$bool_attrib

$tagname

$tagname

$content

$content

$attrib

$attrib

$allowed

$allowed

$type

$type

Methods

__construct()

__construct(array  $attrib = []) : mixed

Object constructor

Parameters

array $attrib

Associative array with tag attributes

Returns

mixed —

show()

show(string  $value = null, array  $attrib = null) : string

Compose input tag

Parameters

string $value

Field value

array $attrib

Additional attributes to override

Returns

string —

HTML output

tag()

tag(string  $tagname, array  $attrib = [], string  $content = null, array  $allowed = null) : string

Generic method to create a HTML tag

Parameters

string $tagname

Tag name

array $attrib

Tag attributes as key/value pairs

string $content

Optional Tag content (creates a container tag)

array $allowed

List with allowed attributes, omit to allow all

Returns

string —

The XHTML tag

doctype()

doctype(string  $type) : mixed

Return DOCTYPE tag of specified type

Parameters

string $type

Document type (html5, xhtml, 'xhtml-trans, xhtml-strict)

Returns

mixed —

div()

div(mixed  $attr = null, string  $cont = null) : string

Derived method for <div> containers

Parameters

mixed $attr

Hash array with tag attributes or string with class name

string $cont

Div content

Returns

string —

HTML code

p()

p(mixed  $attr = null, string  $cont = null) : string

Derived method for <p> blocks

Parameters

mixed $attr

Hash array with tag attributes or string with class name

string $cont

Paragraph content

Returns

string —

HTML code

img()

img(string|array  $attr = null) : string

Derived method to create <img />

Parameters

string|array $attr

Hash array with tag attributes or string with image source (src)

Returns

string —

HTML code

a()

a(string|array  $attr, string  $cont) : string

Derived method for link tags

Parameters

string|array $attr

Hash array with tag attributes or string with link location (href)

string $cont

Link content

Returns

string —

HTML code

span()

span(string|array  $attr, string  $cont) : string

Derived method for inline span tags

Parameters

string|array $attr

Hash array with tag attributes or string with class name

string $cont

Tag content

Returns

string —

HTML code

label()

label(string|array  $attr, string  $cont) : string

Derived method for form element labels

Parameters

string|array $attr

Hash array with tag attributes or string with 'for' attrib

string $cont

Tag content

Returns

string —

HTML code

iframe()

iframe(string|array  $attr = null, string  $cont = null) : string

Derived method to create <iframe></iframe>

Parameters

string|array $attr

Hash array with tag attributes or string with frame source (src)

string $cont

Tag content

Returns

string —

HTML code

script()

script(string|array  $attr, string  $cont = null) : string

Derived method to create <script> tags

Parameters

string|array $attr

Hash array with tag attributes or string with script source (src)

string $cont

Javascript code to be placed as tag content

Returns

string —

HTML code

br()

br(array  $attrib = []) : string

Derived method for line breaks

Parameters

array $attrib

Associative array with tag attributes

Returns

string —

HTML code

attrib_string()

attrib_string(array  $attrib = [], array  $allowed = null) : string

Create string with attributes

Parameters

array $attrib

Associative array with tag attributes

array $allowed

List of allowed attributes

Returns

string —

Valid attribute string

parse_attrib_string()

parse_attrib_string(string  $str) : array

Convert a HTML attribute string attributes to an associative array (name => value)

Parameters

string $str

Input string

Returns

array —

Key-value pairs of parsed attributes

quote()

quote(string  $str) : string

Replacing specials characters in html attribute value

Parameters

string $str

Input string

Returns

string —

The quoted string